package ru.adhoc.truealarmfree.vibrator;

import android.content.Context;
import android.os.Vibrator;

/**
 * Created by Малюгин Сергей on 16.08.13.
 */
public class Vibro {

    private static Vibro instance;
    Context context;
    Vibrator v;

    public Vibro(Context c) {
        context = c;
        v = (Vibrator)context.getSystemService(Context.VIBRATOR_SERVICE);
    }

    public static Vibro getInstance(Context ctx){
        if (instance == null){
            instance = new Vibro(ctx);
        }
        return instance;
    }

    public void startVibro(){
        long[] pattern = {0, 2000, 1000};
        v.vibrate(pattern,0);
    }

    public void stopVibro(){
        v.cancel();
    }

}
